<fieldset class="layui-elem-field">
    <legend>添加车辆</legend>
    <div class="layui-field-box">
        <form action="{:url('Carmanage/updCar')}" class="layui-form   ajax-form" method="post"
              style="margin: 20px">
            <div class="layui-row">
                <div class="layui-col-md6">
                    <div class="layui-form-item">
                        <label class="layui-form-label">汽车图片</label>
                        <div class="layui-input-inline">
                            <button type="button" class="layui-btn upload" required>
                                <i class="layui-icon"></i>上传图片
                            </button>
                        </div>
                    </div>
                    <div class="layui-form-item uploadDiv" style="display: block;margin-left: 110px">
                        <img src="{$carimg.car_img}" class="uploadImg" width="100">
                    </div>


                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">汽车品牌</label>
                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                    <select name="cartype_id" data-url="{:url('common/gettypelist')}" lay-filter="cartype" lay-verify="required">
                                        <option value="">请选择品牌</option>
                                        {volist name='cartype' id='c'}
                                        <option value="{$c.cartype_id}" {eq name="$c.cartype_id" value="$car['cartype_id']" }selected{/eq} >{$c.cartype_what}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                    <select name="cartype_ids" data-url="{:url('common/gettypelist')}" lay-filter="cartypes" class="cartypes" lay-verify="required">
                                        <option value="">请选择型号</option>
                                        {volist name='cartwotype' id='cp'}
                                        <option value="{$cp.cartype_id}" {eq name="$cp.cartype_id" value="$car['cartype_ids']" }selected{/eq} >{$cp.cartype_what}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">汽车类型</label>
                        <div class="layui-input-inline">
                            <select name="car_type" lay-filter="aihao" lay-verify="required">
                                <option value="">请选择汽车类型</option>
                                <option value="1" {eq name="$car.car_type" value="1"}selected{/eq}>轿车</option>
                                <option value="2" {eq name="$car.car_type" value="2"}selected{/eq}>越野车</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">车牌照</label>
                            <div class="layui-input-inline">
                                <input type="text" name="car_plate" value="{$car.car_plate}" maxlength="8"
                                       autocomplete="off" placeholder="请输入车牌照如冀A88888" class="layui-input" lay-verify="required">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">车主</label>
                        <div class="layui-input-inline">
                            <select name="car_who" lay-filter="aihao" lay-verify="required">
                                <option value="1" {eq name="$car.car_who" value="1"}selected{/eq}>总公司</option>
                                <option value="2" {eq name="$car.car_who" value="2"}selected{/eq}>分公司</option>
                                <option value="3" {eq name="$car.car_who" value="3"}selected{/eq}>个人</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">车辆颜色</label>
                            <div class="layui-input-inline">
                                <input type="text" name="car_color" value="{$car.car_color}" maxlength="8"
                                       autocomplete="off" placeholder="请输入车辆颜色" class="layui-input" lay-verify="required">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">是否挂靠</label>
                        <div class="layui-input-inline">
                            <select name="car_hangup" lay-filter="aihao" lay-verify="required">
                                <option value="1" {eq name="$car.car_hangup" value="1"}selected{/eq}>是</option>
                                <option value="2" {eq name="$car.car_hangup" value="2"}selected{/eq}>否</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">所属公司</label>
                        <div class="layui-input-inline">
                            <select name="store_id" lay-filter="selectId" lay-verify="required">
                                <option value="">公司名称</option>
                                {volist name="store" id="s"}
                                <option value="{$s.store_id}" {eq name="$s.store_id" value="$car['store_id']" }selected{/eq} >{$s.store_name}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">车架号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="classno" value="{$car.classno}"
                                       autocomplete="off" placeholder="冀A车辆请填写后4位" class="layui-input" lay-verify="required">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">发动机号</label>
                            <div class="layui-input-inline">
                                <input type="text" name="engineno" value="{$car.engineno}"
                                       autocomplete="off" placeholder="冀A车辆请填写后6位" class="layui-input" lay-verify="required">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">保险到期日</label>
                            <div class="layui-input-inline">
                                <input type="text" name="car_riskover" value="{$car.car_riskover|conversionDate}"  lay-verify="required" placeholder="保险到期日" autocomplete="off" class="layui-input laydate-date-four">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">年检到期日</label>
                            <div class="layui-input-inline">
                                <input type="text" name="car_yearover" value="{$car.car_yearover|conversionDate}"  lay-verify="required" placeholder="年检到期日" autocomplete="off" class="layui-input laydate-date-one">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">上次保养日</label>
                            <div class="layui-input-inline">
                                <input type="text" name="car_lastmaintain"  value="{$car.car_lastmaintain|conversionDate}" lay-verify="required" placeholder="上次保养日" autocomplete="off" class="layui-input laydate-date-two">
                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">生产日期</label>
                            <div class="layui-input-inline">
                                <input type="text" name="car_seeworldtime" value="{$car.car_seeworldtime|conversionDate}"  lay-verify="required" placeholder="生产日期" autocomplete="off" class="layui-input laydate-date-three">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">租赁类型</label>

                            {if $car['is_secular']==1}
                            <span class="radio" val="1"><input type="radio" name="is_secular" value="1"  title="长期"  checked></span>
                            <span class="radio" val="2"><input type="radio" name="is_secular" value="2" title="短期"></span>
                            {else/}
                            <span class="radio" val="1"><input type="radio" name="is_secular" value="1"  title="长期"  ></span>
                            <span class="radio" val="2"><input type="radio" name="is_secular" value="2" title="短期" checked></span>
                            {/if}

                        </div>
                    </div>

                    {if $car['is_secular']==2}
                    <div class="layui-form-item z-time">
                        <div class="layui-inline">
                            <label class="layui-form-label">租赁有效期</label>
                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                    <input type="text" name="start_time" value="{$car.start_time|conversionDate}"
                                           autocomplete="off" class="layui-input laydate-date-start" placeholder="请选择开始时间">
                                </div>
                            </div>——
                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                    <input type="text" name="end_time" value="{$car.start_time|conversionDate}"
                                           autocomplete="off" class="layui-input laydate-date-end" placeholder="请选择结束时间">
                                </div>
                            </div>
                        </div>
                    </div>
                    {/if}
                </div>
            </div>
            <div class="layui-form-item ">
                <label class="layui-form-label"> </label>
                <input type="hidden" name="car_id" value="{$car.car_id}">
                <input type="hidden" name="car_img_id" value="{$carimg.car_img_id}">
                <button class="layui-btn" lay-submit="">确定</button>
                <a class="layui-btn  layui-btn-primary" href="{:url('Carmanage/carstatus')}">返回</a>
            </div>
        </form>
    </div>
</fieldset>



<script>
    $(".radio").click(function(){
        var val = $(this).attr("val");
        if(val==1){
            $(".z-time").css('display', 'none');
        } else {
            $(".z-time").css('display', 'block');
        }
    });
</script>